import request from '@/utils/request'

const role = {
  /**
   * 分页
   * @param page
   * @param query
   */
  listRole(page,query) {
    return request({
      url: 'admin/sys-role/page/' + page.current + '/' + page.size,
      method: 'get',
      params: query

    })
  },

  getRoleList(id){
    return request({
      url: 'admin/sys-role/option/select/' + id,
      method: 'get'
    })
  },

  getRole(id) {
    return request({
      url: 'admin/sys-role/get/' + id,
      method: 'get'

    })
  },
  delRole(ids) {
    return request({
      url: 'admin/sys-role/remove/' + ids,
      method: 'delete'

    })
  },
  addRole(data) {
    return request({
      url: 'admin/sys-role/create',
      method: 'post',
      data: data

    })
  },
  updateRole(data) {
    return request({
      url: 'admin/sys-role/update',
      method: 'put',
      data: data

    })
  },
  exportRole(data) {
    return request({
      url: 'admin/sys-role/export',
      method: 'put',
      data: data

    })
  },
  dataScope(data) {
    return request({
      url: 'admin/sys-role/change/scope',
      method: 'put',
      data: data

    })
  },
  changeRoleStatus(id, status)  {
    const data = {
      id,
      status
    }
    return request({
      url: 'admin/sys-role/change/status',
      method: 'put',
      data: data

    })
  },

}
export default role
